import http from './interface'

/**
 * 将业务所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 *
 */

// 单独导出(测试接口) import {test} from '@/common/http/'
// export const test = (data) => {
// 	/* http.config.baseUrl = "http://localhost:8080/api/"
// 	//设置请求前拦截器
// 	http.interceptor.request = (config) => {
// 		config.header = {
// 			"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
// 		}
// 	} */
// 	//设置请求结束后拦截器
// 	http.interceptor.response = (response) => {
// 		console.log('个性化response....')
// 		//判断返回状态 执行相应操作
// 		return response;
// 	}
//     return http.request({
// 		baseUrl: 'https://unidemo.dcloud.net.cn/',
//         url: 'ajax/echo/text?name=uni-app',
// 		dataType: 'text',
//         data,
//     })
// }

// 轮播图
export const banner = (data) => {
    return http.request({
        url: '/swiper/list',
        method: 'POST',
        data,
    })
}
//一级分类
export const getMold = () => {
    return http.request({
        url: '/goods/mold',
        method: 'POST',
    })
}
// 二级分类
export const getMoldTwo = (data) => {
    return http.request({
        url: '/goods/brand',
        method: 'POST',
        data,
    })
}
export const getGoods = (data) => {
    return http.request({
        url: '/goods/list',
        method: 'POST',
        data,
    })
}
export const getDetail = (data) => {
    return http.request({
        url: '/goods/get',
        method: 'POST',
        data,
    })
}
export const getCodeId = (data)=>{
    return http.request({
        url: '/alilogin/code',
        method: 'POST',
        data,
    })
}
export const getId = (data)=>{
    return http.request({
        url: '/alilogin/getId',
        method: 'POST',
        data,
    })
}
export const getUser = (data)=>{
    return http.request({
        url: '/user/getUser',
        method: 'POST',
        data,
    })
}
export const getAlipayId = (data)=>{
    return http.request({
        url: '/alilogin/getAlipayId',
        method: 'POST',
        data,
    })
}
export const login = (data)=>{
    return http.request({
        url: '/alilogin/login',
        method: 'POST',
        data,
    })
}
export const getPhone = (data)=>{
    return http.request({
        url: '/swiper/info',
        method: 'POST',
        data,
    })
}
export const addFeedback = (data)=>{
    return http.request({
        url: '/user/addFeedback',
        method: 'POST',
        data,
    })
}
export const getMobile = (data)=>{
    return http.request({
        url: '/alilogin/mobile',
        method: 'POST',
        data,
    })
}
export const userCertifyInitialize = (data)=>{
    return http.request({
        url: '/user/usercertifyinitialize',
        method: 'POST',
        data,
    })
}
export const saveUserApprove = (data)=>{
    return http.request({
        url: '/user/save',
        method: 'POST',
        data,
    })
}
export const getApprove = (data)=>{
    return http.request({
        url: '/user/getApprove',
        method: 'POST',
        data,
    })
}
export const getPayList = (data)=>{
    return http.request({
        url: '/order/list',
        method: 'POST',
        data,
    })
}
export const getOrderDetail = (data)=>{
    return http.request({
        url: '/order/detail',
        method: 'POST',
        data,
    })
}
export const cancelOrder = (data)=>{
    return http.request({
        url: '/order/cancelOrder',
        method: 'POST',
        data,
    })
}
export const orderPay =(data)=>{
    return http.request({
        url: '/pay/pay',
        method: 'POST',
        data,
    })
}
export const createWithholdSign =(data)=>{
    return http.request({
        url: '/pay/createWithholdSign',
        method: 'POST',
        data,
    })
}
export const getPdf =(data)=>{
    return http.request({
        url: '/order/getPdf',
        method: 'POST',
        data,
    })
}
export const onPay =(data)=>{
    return http.request({
        url: '/pay/itemPay',
        method: 'POST',
        data,
    })
}
export const buyOut =(data)=>{
    return http.request({
        url: '/pay/buyOut',
        method: 'POST',
        data,
    })
}
// 默认全部导出  import api from '@/common/http/'
export default {
    banner,
    getMold,
    getMoldTwo,
    getGoods,
    getDetail,
    getCodeId,
    getId,
    login,
    getPhone,
    addFeedback,
    userCertifyInitialize,
    getApprove,
    getPayList,
    getOrderDetail,
    getPdf,
    onPay
}